package com.esri.core.internal.util;

import com.esri.core.geometry.Geometry;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.MapGeometry;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.map.Feature;
import com.esri.core.map.FeatureTemplate;
import com.esri.core.map.Graphic;
import com.esri.core.renderer.ClassBreaksRenderer;
import com.esri.core.renderer.DictionaryRenderer;
import com.esri.core.renderer.Renderer;
import com.esri.core.renderer.SimpleRenderer;
import com.esri.core.renderer.UniqueValueRenderer;
import com.esri.core.symbol.Symbol;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TimeZone;
import org.codehaus.jackson.JsonFactory;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.MappingJsonFactory;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.node.ArrayNode;
import org.codehaus.jackson.util.MinimalPrettyPrinter;

/* loaded from: classes.dex */
public class d implements Serializable {
    static final ObjectMapper a = new ObjectMapper();
    public static final JsonFactory b = new JsonFactory();
    private static final String c = "esriGeometryPoint";
    private static final String d = "esriGeometryMultipoint";
    private static final String e = "esriGeometryPolyline";
    private static final String f = "esriGeometryPolygon";
    private static final String g = "esriGeometryEnvelope";
    private static final int h = 0;
    private static final int i = 1;
    private static final int j = 2;
    private static final int k = 3;
    private static final int l = 4;
    private static final int m = 5;
    private static final int n = 6;
    private static final int o = 7;
    private static final int p = 8;
    private static final int q = 10;
    private static final long serialVersionUID = 1;

    private static final int a(int i2, int i3, int i4, int i5) {
        return (i2 << 24) | (i3 << 16) | (i4 << 8) | i5;
    }

    private static final boolean a(int i2) {
        return i2 == 102113 || i2 == 3785 || i2 == 102100 || i2 == 3857;
    }

    /* JADX WARN: Code restructure failed: missing block: B:99:0x001b, code lost:
        if (r9.getCurrentToken() != org.codehaus.jackson.JsonToken.START_ARRAY) goto L8;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static java.util.Map<java.lang.String, java.lang.Object> a(org.codehaus.jackson.JsonParser r9) {
        /*
            Method dump skipped, instructions count: 286
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.internal.util.d.a(org.codehaus.jackson.JsonParser):java.util.Map");
    }

    public static Map<String, Object> a(String str) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        if (str == null) {
            return linkedHashMap;
        }
        try {
            return a(c(str));
        } catch (IOException e2) {
            e2.printStackTrace();
            return linkedHashMap;
        } catch (Exception e3) {
            e3.printStackTrace();
            return linkedHashMap;
        }
    }

    /* JADX WARN: Not initialized variable reg: 2, insn: 0x0179: MOVE  (r0 I:??[OBJECT, ARRAY]) = (r2 I:??[OBJECT, ARRAY]), block:B:181:0x0179 */
    /* JADX WARN: Removed duplicated region for block: B:223:0x01bc  */
    /* JADX WARN: Removed duplicated region for block: B:225:0x01af A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:251:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static java.lang.String a(java.util.Map<java.lang.String, java.lang.Object> r8) {
        /*
            Method dump skipped, instructions count: 453
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.internal.util.d.a(java.util.Map):java.lang.String");
    }

    public static final boolean a(SpatialReference spatialReference, SpatialReference spatialReference2) {
        if (spatialReference == spatialReference2) {
            return true;
        }
        if (spatialReference != null && spatialReference2 != null) {
            if (spatialReference.getID() > 0 && spatialReference2.getID() > 0) {
                if (spatialReference.getID() == spatialReference2.getID()) {
                    return true;
                }
                if (a(spatialReference.getID()) && a(spatialReference2.getID())) {
                    return true;
                }
            }
            if (spatialReference.getText() != null && spatialReference2.getText() != null && spatialReference.getText().equals(spatialReference2.getText())) {
                return true;
            }
        }
        return false;
    }

    public static final void a(JsonParser jsonParser, Map<String, Object> map) throws IOException {
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            return;
        }
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            try {
                if (jsonParser.getCurrentToken() == JsonToken.VALUE_NUMBER_INT) {
                    map.put(currentName, Integer.valueOf(jsonParser.getIntValue()));
                } else if (jsonParser.getCurrentToken() == JsonToken.VALUE_NUMBER_FLOAT) {
                    map.put(currentName, Double.valueOf(jsonParser.getDoubleValue()));
                } else {
                    if (jsonParser.getCurrentToken() != JsonToken.VALUE_FALSE && jsonParser.getCurrentToken() != JsonToken.VALUE_TRUE) {
                        if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
                            map.put(currentName, null);
                        } else {
                            map.put(currentName, jsonParser.getText());
                        }
                    }
                    map.put(currentName, Boolean.valueOf(jsonParser.getBooleanValue()));
                }
            } catch (JsonParseException unused) {
                if (jsonParser.getCurrentToken() == JsonToken.VALUE_NUMBER_INT) {
                    map.put(currentName, Long.valueOf(jsonParser.getLongValue()));
                } else {
                    map.put(currentName, jsonParser.getText());
                }
            }
        }
    }

    public static final String b(Map<String, Object> map) throws IOException {
        if (map == null || map.isEmpty()) {
            return null;
        }
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a2 = a(stringWriter);
        a2.writeStartObject();
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            if (entry.getKey() != null) {
                if (entry.getValue() != null) {
                    if (entry.getValue() instanceof Integer) {
                        a2.writeNumberField(entry.getKey(), ((Integer) entry.getValue()).intValue());
                    } else if (entry.getValue() instanceof Float) {
                        a2.writeNumberField(entry.getKey(), ((Float) entry.getValue()).floatValue());
                    } else if (entry.getValue() instanceof Double) {
                        a2.writeNumberField(entry.getKey(), ((Double) entry.getValue()).doubleValue());
                    } else if (entry.getValue() instanceof Boolean) {
                        a2.writeBooleanField(entry.getKey(), ((Boolean) entry.getValue()).booleanValue());
                    } else {
                        a2.writeStringField(entry.getKey(), entry.getValue().toString());
                    }
                } else {
                    a2.writeNullField(entry.getKey());
                }
            }
        }
        a2.writeEndObject();
        a2.close();
        return stringWriter.toString();
    }

    public static final void a(ObjectOutputStream objectOutputStream, Map<String, Object> map) throws IOException {
        if (map == null) {
            objectOutputStream.writeInt(0);
            return;
        }
        objectOutputStream.writeInt(map.size());
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            objectOutputStream.writeObject(entry.getKey());
            objectOutputStream.writeObject(entry.getValue());
        }
    }

    public static final Map<String, Object> a(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        int readInt = objectInputStream.readInt();
        if (readInt > 0) {
            for (int i2 = 0; i2 < readInt; i2++) {
                linkedHashMap.put((String) objectInputStream.readObject(), objectInputStream.readObject());
            }
        }
        return linkedHashMap;
    }

    public static final JsonNode b(JsonParser jsonParser) throws Exception {
        if (jsonParser == null) {
            return null;
        }
        return a.readTree(jsonParser);
    }

    public static final boolean c(JsonParser jsonParser) throws Exception {
        if (jsonParser.getCurrentToken() == null) {
            if (jsonParser.nextToken() == JsonToken.START_OBJECT) {
                return true;
            }
        } else if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
            return true;
        }
        return false;
    }

    public static final String a(Object obj) throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator createJsonGenerator = new MappingJsonFactory().createJsonGenerator(stringWriter);
        createJsonGenerator.writeObject(obj);
        createJsonGenerator.close();
        stringWriter.close();
        return stringWriter.getBuffer().toString();
    }

    public static final String b(Object obj) throws Exception {
        StringWriter stringWriter = new StringWriter();
        ObjectMapper objectMapper = new ObjectMapper();
        JsonGenerator createJsonGenerator = new MappingJsonFactory().createJsonGenerator(stringWriter);
        objectMapper.writeValue(createJsonGenerator, obj);
        createJsonGenerator.close();
        stringWriter.close();
        return stringWriter.getBuffer().toString();
    }

    public static final String a(Object[] objArr, String str) throws Exception {
        StringBuilder sb;
        if (objArr != null) {
            sb = new StringBuilder();
            boolean z = true;
            for (Object obj : objArr) {
                if (z) {
                    z = false;
                } else {
                    sb.append(str == null ? MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR : str);
                }
                sb.append(obj);
            }
        } else {
            sb = null;
        }
        if (sb == null) {
            return null;
        }
        return sb.toString();
    }

    public static final Geometry d(JsonParser jsonParser) {
        MapGeometry jsonToGeometry = GeometryEngine.jsonToGeometry(jsonParser);
        if (jsonToGeometry == null) {
            return null;
        }
        return jsonToGeometry.getGeometry();
    }

    public static final MapGeometry e(JsonParser jsonParser) {
        return GeometryEngine.jsonToGeometry(jsonParser);
    }

    public static final Geometry.Type b(String str) {
        if (c.equals(str)) {
            return Geometry.Type.POINT;
        }
        if (d.equals(str)) {
            return Geometry.Type.MULTIPOINT;
        }
        if (e.equals(str)) {
            return Geometry.Type.POLYLINE;
        }
        if (f.equals(str)) {
            return Geometry.Type.POLYGON;
        }
        if (g.equals(str)) {
            return Geometry.Type.ENVELOPE;
        }
        return null;
    }

    public static final String a(Geometry.Type type) {
        if (Geometry.Type.POINT.equals(type)) {
            return c;
        }
        if (Geometry.Type.MULTIPOINT.equals(type)) {
            return d;
        }
        if (Geometry.Type.POLYLINE.equals(type)) {
            return e;
        }
        if (Geometry.Type.POLYGON.equals(type)) {
            return f;
        }
        if (Geometry.Type.ENVELOPE.equals(type)) {
            return g;
        }
        return null;
    }

    public static final String a(SpatialReference spatialReference) throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a2 = a(stringWriter);
        a2.writeStartObject();
        if (spatialReference.getID() != -1) {
            a2.writeNumberField("wkid", spatialReference.getID());
            a2.writeNumberField("latestWkid", spatialReference.getLatestID());
        } else if (spatialReference.getText() != null) {
            a2.writeStringField("wkt", spatialReference.getText());
        } else {
            a2.close();
            throw new Exception("The input spatial reference is invalid");
        }
        a2.writeEndObject();
        a2.close();
        return stringWriter.toString();
    }

    public static final Renderer f(JsonParser jsonParser) throws Exception {
        return a(jsonParser, Graphic.class);
    }

    public static final Renderer g(JsonParser jsonParser) throws Exception {
        return a(jsonParser, Feature.class);
    }

    private static final <V> Renderer a(JsonParser jsonParser, Class<V> cls) throws Exception {
        JsonNode readTree = a.readTree(jsonParser);
        JsonNode jsonNode = readTree != null ? readTree.get("type") : null;
        if (jsonNode != null) {
            String textValue = jsonNode.getTextValue();
            if (SimpleRenderer.TYPE.equals(textValue)) {
                return (Renderer) Class.forName("com.esri.core.renderer.SimpleRenderer").getConstructor(JsonNode.class).newInstance(readTree);
            }
            if (UniqueValueRenderer.TYPE.equals(textValue)) {
                return (Renderer) Class.forName("com.esri.core.renderer.UniqueValueRenderer").getConstructor(JsonNode.class).newInstance(readTree);
            }
            if (ClassBreaksRenderer.TYPE.equals(textValue)) {
                return (Renderer) Class.forName("com.esri.core.renderer.ClassBreaksRenderer").getConstructor(JsonNode.class).newInstance(readTree);
            }
            if (DictionaryRenderer.TYPE.equals(textValue)) {
                Constructor<?> declaredConstructor = Class.forName("com.esri.core.renderer.DictionaryRenderer").getDeclaredConstructor(JsonNode.class);
                declaredConstructor.setAccessible(true);
                return (Renderer) declaredConstructor.newInstance(readTree);
            }
            return null;
        }
        return null;
    }

    public static final Symbol h(JsonParser jsonParser) throws Exception {
        return h.a(jsonParser);
    }

    public static Symbol i(JsonParser jsonParser) {
        try {
            return h.a(jsonParser);
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public static String a(Graphic graphic, SpatialReference spatialReference) throws Exception {
        return a((Feature) graphic, spatialReference, true);
    }

    public static String a(Feature feature, SpatialReference spatialReference, boolean z) throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator createJsonGenerator = new MappingJsonFactory().createJsonGenerator(stringWriter);
        createJsonGenerator.writeStartObject();
        Map<String, Object> attributes = feature.getAttributes();
        createJsonGenerator.writeFieldName("attributes");
        createJsonGenerator.writeObject(attributes);
        if (feature.getGeometry() != null && z) {
            createJsonGenerator.writeFieldName("geometry");
            createJsonGenerator.writeRawValue(GeometryEngine.geometryToJson(spatialReference, feature.getGeometry()));
        }
        createJsonGenerator.writeEndObject();
        createJsonGenerator.close();
        return stringWriter.getBuffer().toString();
    }

    public static Graphic j(JsonParser jsonParser) throws Exception {
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            return null;
        }
        Geometry geometry = null;
        LinkedHashMap linkedHashMap = null;
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("geometry".equals(currentName)) {
                geometry = d(jsonParser);
            } else if ("attributes".equals(currentName)) {
                linkedHashMap = new LinkedHashMap();
                a(jsonParser, linkedHashMap);
            } else {
                jsonParser.skipChildren();
            }
        }
        return new Graphic(geometry, (Symbol) null, linkedHashMap);
    }

    public static final JsonGenerator a(StringWriter stringWriter) throws IOException {
        return b.createJsonGenerator(stringWriter);
    }

    public static final JsonParser c(String str) throws IOException {
        JsonParser createJsonParser = b.createJsonParser(str);
        createJsonParser.enable(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER);
        createJsonParser.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS);
        createJsonParser.enable(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS);
        return createJsonParser;
    }

    public static final JsonParser a(InputStream inputStream) throws IOException {
        JsonParser createJsonParser = b.createJsonParser(inputStream);
        createJsonParser.enable(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER);
        createJsonParser.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS);
        createJsonParser.enable(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS);
        return createJsonParser;
    }

    public static final ObjectMapper a() {
        return a;
    }

    public static final String a(JsonNode jsonNode, String str) {
        return a(jsonNode, str, (String) null);
    }

    public static final String a(JsonNode jsonNode, String str, String str2) {
        JsonNode jsonNode2 = jsonNode.get(str);
        return jsonNode2 != null ? jsonNode2.getTextValue() : str2;
    }

    public static final void a(JsonGenerator jsonGenerator, String str, String str2) throws Exception {
        if (str2 == null || str2.length() <= 0) {
            return;
        }
        jsonGenerator.writeStringField(str, str2);
    }

    public static final byte[] b(JsonNode jsonNode, String str) throws Exception {
        String textValue;
        JsonNode jsonNode2 = jsonNode.get(str);
        if (jsonNode2 == null || (textValue = jsonNode2.getTextValue()) == null) {
            return null;
        }
        return textValue.getBytes();
    }

    public static final void a(JsonGenerator jsonGenerator, String str, byte[] bArr) throws Exception {
        if (bArr != null) {
            jsonGenerator.writeBinaryField(str, bArr);
        }
    }

    public static final int a(JsonNode jsonNode, String str, int i2) {
        JsonNode jsonNode2 = jsonNode.get(str);
        return jsonNode2 != null ? jsonNode2.getIntValue() : i2;
    }

    public static final void a(JsonGenerator jsonGenerator, String str, int i2) throws Exception {
        jsonGenerator.writeNumberField(str, i2);
    }

    public static final void a(JsonGenerator jsonGenerator, String str, long j2) throws Exception {
        jsonGenerator.writeNumberField(str, j2);
    }

    public static final float a(JsonNode jsonNode, String str, float f2) {
        double d2 = f2;
        JsonNode jsonNode2 = jsonNode.get(str);
        if (jsonNode2 != null) {
            d2 = jsonNode2.getDoubleValue();
        }
        return (float) d2;
    }

    public static final void a(JsonGenerator jsonGenerator, String str, float f2) throws Exception {
        jsonGenerator.writeNumberField(str, f2);
    }

    public static final void a(JsonGenerator jsonGenerator, String str, double d2) throws Exception {
        jsonGenerator.writeNumberField(str, d2);
    }

    public static final void a(JsonGenerator jsonGenerator, String str, double d2, int i2) throws Exception {
        DecimalFormat decimalFormat = new DecimalFormat();
        decimalFormat.setMaximumFractionDigits(i2);
        decimalFormat.setGroupingUsed(false);
        jsonGenerator.writeFieldName(str);
        jsonGenerator.writeRawValue(decimalFormat.format(d2));
    }

    public static final void a(JsonGenerator jsonGenerator, String str, boolean z) throws Exception {
        jsonGenerator.writeBooleanField(str, z);
    }

    public static final void a(JsonGenerator jsonGenerator, String str, int[] iArr) throws Exception {
        if (iArr == null) {
            return;
        }
        jsonGenerator.writeArrayFieldStart(str);
        for (int i2 : iArr) {
            jsonGenerator.writeNumber(i2);
        }
        jsonGenerator.writeEndArray();
    }

    public static final void a(JsonGenerator jsonGenerator, String str, double[] dArr) throws Exception {
        if (dArr == null) {
            return;
        }
        jsonGenerator.writeArrayFieldStart(str);
        for (double d2 : dArr) {
            jsonGenerator.writeNumber(d2);
        }
        jsonGenerator.writeEndArray();
    }

    public static final void a(JsonGenerator jsonGenerator, String str, String[] strArr) throws Exception {
        if (strArr == null) {
            return;
        }
        jsonGenerator.writeArrayFieldStart(str);
        for (String str2 : strArr) {
            jsonGenerator.writeString(str2);
        }
        jsonGenerator.writeEndArray();
    }

    public static final int b(JsonNode jsonNode, String str, int i2) {
        JsonNode jsonNode2 = jsonNode.get(str);
        if (jsonNode2 == null || !(jsonNode2 instanceof ArrayNode)) {
            return i2;
        }
        ArrayNode arrayNode = (ArrayNode) jsonNode2;
        return a(arrayNode.get(3).getIntValue(), arrayNode.get(0).getIntValue(), arrayNode.get(1).getIntValue(), arrayNode.get(2).getIntValue());
    }

    public static final void b(JsonGenerator jsonGenerator, String str, int i2) throws Exception {
        jsonGenerator.writeArrayFieldStart(str);
        jsonGenerator.writeNumber((i2 >> 16) & 255);
        jsonGenerator.writeNumber((i2 >> 8) & 255);
        jsonGenerator.writeNumber(i2 & 255);
        jsonGenerator.writeNumber((i2 >> 24) & 255);
        jsonGenerator.writeEndArray();
    }

    public static final float b(JsonNode jsonNode, String str, float f2) {
        JsonNode jsonNode2;
        double d2 = f2;
        JsonNode jsonNode3 = jsonNode.get(str);
        if (jsonNode3 != null && (jsonNode2 = jsonNode3.get("size")) != null) {
            d2 = jsonNode2.getDoubleValue();
        }
        return (float) d2;
    }

    public static final void b(JsonGenerator jsonGenerator, String str, float f2) throws Exception {
        if (f2 > 0.0f) {
            jsonGenerator.writeObjectFieldStart(str);
            jsonGenerator.writeNumberField("size", (int) f2);
            jsonGenerator.writeEndObject();
        }
    }

    public static final double[] k(JsonParser jsonParser) throws IOException, JsonParseException {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            ArrayList arrayList = new ArrayList();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                arrayList.add(Double.valueOf(jsonParser.getDoubleValue()));
            }
            if (!arrayList.isEmpty()) {
                double[] dArr = new double[arrayList.size()];
                int i2 = 0;
                Iterator it = arrayList.iterator();
                while (it.hasNext()) {
                    dArr[i2] = ((Double) it.next()).doubleValue();
                    i2++;
                }
                return dArr;
            }
        }
        return null;
    }

    public static final JsonParser a(byte[] bArr) throws JsonParseException, IOException {
        if (bArr != null) {
            JsonParser createJsonParser = b.createJsonParser(bArr);
            createJsonParser.enable(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER);
            createJsonParser.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS);
            createJsonParser.enable(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS);
            return createJsonParser;
        }
        return null;
    }

    public static TimeZone l(JsonParser jsonParser) throws JsonParseException, IOException {
        TimeZone timeZone = null;
        if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if ("timeZone".equals(currentName)) {
                    timeZone = TimeZone.getTimeZone(jsonParser.getText());
                } else {
                    jsonParser.skipChildren();
                }
            }
        }
        return timeZone;
    }

    public static long[] m(JsonParser jsonParser) throws JsonParseException, IOException {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            ArrayList arrayList = new ArrayList();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                arrayList.add(Long.valueOf(jsonParser.getLongValue()));
            }
            if (!arrayList.isEmpty()) {
                long[] jArr = new long[arrayList.size()];
                int i2 = 0;
                Iterator it = arrayList.iterator();
                while (it.hasNext()) {
                    jArr[i2] = ((Long) it.next()).longValue();
                    i2++;
                }
                return jArr;
            }
        }
        return null;
    }

    public static final FeatureTemplate.DRAWING_TOOL b(Geometry.Type type) {
        FeatureTemplate.DRAWING_TOOL drawing_tool = FeatureTemplate.DRAWING_TOOL.NONE;
        if (type != null) {
            switch (AnonymousClass1.a[type.ordinal()]) {
                case 1:
                case 2:
                    return FeatureTemplate.DRAWING_TOOL.POINT;
                case 3:
                case 4:
                    return FeatureTemplate.DRAWING_TOOL.LINE;
                case 5:
                case 6:
                    return FeatureTemplate.DRAWING_TOOL.POLYGON;
                default:
                    return FeatureTemplate.DRAWING_TOOL.NONE;
            }
        }
        return drawing_tool;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: com.esri.core.internal.util.d$1 */
    /* loaded from: classes.dex */
    public static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] a;

        static {
            int[] iArr = new int[Geometry.Type.values().length];
            a = iArr;
            try {
                iArr[Geometry.Type.POINT.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[Geometry.Type.MULTIPOINT.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[Geometry.Type.LINE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[Geometry.Type.POLYLINE.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[Geometry.Type.ENVELOPE.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[Geometry.Type.POLYGON.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                a[Geometry.Type.UNKNOWN.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
        }
    }

    public static final String a(int[] iArr) {
        StringBuilder sb = new StringBuilder();
        boolean z = true;
        for (int i2 : iArr) {
            if (i2 >= 0) {
                if (z) {
                    sb.append(i2);
                    z = false;
                } else {
                    sb.append(',');
                    sb.append(i2);
                }
            }
        }
        return sb.toString();
    }

    public static final String a(String[] strArr) {
        StringBuilder sb = new StringBuilder();
        boolean z = true;
        for (String str : strArr) {
            if (str != null) {
                if (z) {
                    sb.append(str);
                    z = false;
                } else {
                    sb.append(',');
                    sb.append(str);
                }
            }
        }
        return sb.toString();
    }
}
